#ifndef __BEGIN_UI_LOGIC_H__
#define __BEGIN_UI_LOGIC_H__
#include "UIBeginLayout.h"
#include "../include/IGameLogic.h"
namespace fishingjoy
{
	namespace ui
	{
		class CBeginUILogic
		{
			UI_BeginLayout m_BeginLayout;
			logic::IGameLogic* m_pGameLogic;
		public:
			CBeginUILogic(logic::IGameLogic* p,cocos2d::CCLayer* pParent)
			{
				m_pGameLogic = p;
				pParent->addChild(&m_BeginLayout);

				base::Delegate<void(void)> gps(this,&CBeginUILogic::slot_PlayGame);;
				m_BeginLayout.Event_BeginGame += gps;

				base::Delegate<void(void)> ges(this,&CBeginUILogic::slot_ExitGame);;
				m_BeginLayout.Event_ExitGame += ges;

				base::Delegate<void(void)> egs(this,&CBeginUILogic::slot_EnterGame);;
				m_pGameLogic->Event_EnterGameSuccessed+=egs; 
			}
		private:
			void slot_PlayGame()
			{
				printf("play game...\n");
				m_pGameLogic->enterGame();
			}
			void slot_ExitGame()
			{
				printf("exit game...\n");
				m_pGameLogic->exitGame();
			}

			void slot_EnterGame()
			{
				m_BeginLayout.setVisible(false);
			}
		};
	}
}
#endif